package com.zzw.springboot.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzw.springboot.bean.SysDictData;
import com.zzw.springboot.mapper.SysDictDataMapper;
import com.zzw.springboot.service.SysDictDataService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 字典数据服务实现类
 */
@Service
public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDictData> implements SysDictDataService {

    /**
     * 根据字典类型获取字典数据
     * @param dictType 字典类型
     * @return 字典数据列表
     */
    @Override
    public List<SysDictData> selectDictDataByType(String dictType) {
        LambdaQueryWrapper<SysDictData> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysDictData::getDictType, dictType)
                .eq(SysDictData::getStatus, 1) // 状态正常
                .orderByAsc(SysDictData::getDictSort); // 按字典排序升序
        return list(queryWrapper);
    }
} 